package com.qf.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.dao.SubscribeDao;
import com.qf.entity.Codes;
import com.qf.entity.Subscribe;
import com.qf.exception.ServiceException;
import com.qf.service.SubscribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 预约婚纱表(Subscribe)表服务实现类
 *
 * @author makejava
 * @since 2023-04-08 10:11:46
 */
@Service("subscribeService")
public class SubscribeServiceImpl extends ServiceImpl<SubscribeDao, Subscribe> implements SubscribeService {
    @Autowired
    private SubscribeDao subscribeDao ;

    @Override
    public int selectYuYue(Subscribe subscribe) {
        Subscribe query = subscribeDao.selectById(subscribe.getId());
        if (query!=null){
            throw new ServiceException(Codes.YUYUE_ERROR);
        }
        int insert = subscribeDao.insert(subscribe);
        return insert;
    }
}

